package common.mq.register.po;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.httpclient.HttpMethod;
import org.apache.thrift.transport.TTransport;

import com.google.gson.annotations.Expose;

public class Consumer {

	private int id;

	private int frequency; // 两次调用统一消费者间隔,单位秒

	@Expose
	private int nextAcceptTime = 0; // 控制信息，消费者接收下一次发送信息时间，本次接收发送信息时间+frequency

	private int repeatInterval; // 重试间隔

	private int repeatCount; // 重试次数

	// 消费者URI信息JSON格式{protocol:xxx,host:xxx,port:xxx,uri:xxx,longCon:0或1,method:xxx}
	private Map<String, String> content = new HashMap<String, String>(); 

	private HttpMethod httpSender;
	
	private TTransport thriftSender;

	public Consumer(int id, int frequency, int repeatInterval, int repeatCount,
			Map<String, String> content) {
		super();
		this.id = id;
		this.frequency = frequency;
		this.repeatInterval = repeatInterval;
		this.repeatCount = repeatCount;
		this.content = content;
	}


	public HttpMethod getHttpSender() {
		return httpSender;
	}

	public void setHttpSender(HttpMethod httpSender) {
		this.httpSender = httpSender;
	}


	public TTransport getThriftSender() {
		return thriftSender;
	}

	public void setThriftSender(TTransport thriftSender) {
		this.thriftSender = thriftSender;
	}

	public Integer getNextAcceptTime() {
		return nextAcceptTime;
	}



	public void setNextAcceptTime(Integer nextAcceptTime) {
		this.nextAcceptTime = nextAcceptTime;
	}



	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getFrequency() {
		return frequency;
	}

	public void setFrequency(int frequency) {
		this.frequency = frequency;
	}

	public int getRepeatInterval() {
		return repeatInterval;
	}

	public void setRepeatInterval(int repeatInterval) {
		this.repeatInterval = repeatInterval;
	}

	public int getRepeatCount() {
		return repeatCount;
	}

	public void setRepeatCount(int repeatCount) {
		this.repeatCount = repeatCount;
	}

	public Map<String, String> getContent() {
		return content;
	}

	public void setContent(Map<String, String> content) {
		this.content = content;
	}

}
